home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7445 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: siemens.at!betik
  2. From: betik@siemens.co.at (Vlade (SWH) / Betik (SWH))
  3. Newsgroups: comp.lang.c
  4. Subject: C-Algorithm question
  5. Date: 26 Feb 1996 16:50:56 GMT
  6. Organization: Siemens AG Austria
  7. Message-ID: <4gsodg$jqm@news.siemens.at>
  8. NNTP-Posting-Host: mx5217.gud.siemens-austria
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Hello friends,
  12.  
  13. I'd like to know if exists a standard algorithm, that transforms this table:
  14.  
  15.  
  16. idx | CA | CS | NB |
  17. ----+----+----+-----
  18.   0 | SU | NO | SG |
  19.   1 | SU | NO | SG |  
  20.   2 | SU | GE | PL |
  21.   3 | AD | GE | SG |
  22.   4 | AD | GE | PL |
  23.   5 | PR | IN | SG |
  24.  
  25. into this tree:
  26.  
  27.                         o NB
  28.                        / \
  29.                -SG----     ----PL-
  30.              /                     \
  31.             o CA                    o CS
  32.           / | \                     |
  33.     --SU-   AD  --PR-               GE
  34.    /        |        \              |
  35.   o CS      o CS      o CS          o CAT
  36.   |         |         |            / \
  37.   NO        GE        IN         SU   AD
  38.   |         |         |          |     |
  39.   o idx     o idx     o idx      o idx o idx
  40.  / \        |         |          |     |
  41. 0   1       3         5          2     4
  42.  
  43. where NB is the root of the tree because it contains the smallest set of its
  44. values [SG,PL], and SG is the first edge of the node NB, because it occurs
  45. the most frequently in the set of the node NB.
  46.  
  47. Thanks for any help.
  48.  
  49. Vlado Betik
  50. betik@swh.sk
  51.